package com.demo.sentinel.init;

import com.alibaba.csp.sentinel.init.InitFunc;
import com.alibaba.nacos.api.PropertyKeyConst;

import java.util.Properties;

/**
 * 独立模式，通过SPI机制加载该类
 * @author cyj
 **/
public class AloneClusterServerInitFunc implements InitFunc {

    private final String namespace = "b4533daf-1569-405a-b618-b9363293c463";
    private final String remoteAddress = "localhost:8848";

    @Override
    public void init() throws Exception {
        Properties properties = new Properties();
        properties.put(PropertyKeyConst.SERVER_ADDR, remoteAddress);
        properties.put(PropertyKeyConst.NAMESPACE, namespace);

        ServerConfigUtil.init(properties);
    }
}
